package me.geolo.photopicker.entity;

import android.support.annotation.StringDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

import static me.geolo.photopicker.entity.ImageType.JPG;
import static me.geolo.photopicker.entity.ImageType.JPEG;
import static me.geolo.photopicker.entity.ImageType.GIF;
import static me.geolo.photopicker.entity.ImageType.PNG;

/**
 *
 *    
 * Created by geolo on 2017/5/15.
 */
@StringDef({JPG, JPEG, GIF, PNG})
@Retention(RetentionPolicy.SOURCE)
public @interface ImageType {
    public static final String JPG = "jpg";
    public static final String JPEG = "jpeg";
    public static final String GIF = "gif";
    public static final String PNG = "png";

    public static class ImageTypeUtil {
        @ImageType
        public static String getValue(String originValue) {
            switch (originValue) {
                case JPG:
                    return JPG;
                case JPEG:
                    return JPEG;
                case GIF:
                    return GIF;
                case PNG:
                    return PNG;
            }
            return JPG;
        }
    }
}
